home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_08
/
1008129a
< prev
next >
Wrap
Text File
|
1992-06-07
|
887b
|
31 lines
#include <stdio.h>
struct s_node
{
struct s_node *next_node;
char *string_value;
};
void main()
{
/* Let's just do static initialization for now */
static struct s_node fourth_node = { NULL, "Four"};
static struct s_node third_node = {&fourth_node, "Three"};
static struct s_node second_node = {&third_node, "Second"};
static struct s_node first_node = {&second_node, "First"};
static struct s_node *root_node = &first_node;
static struct s_node *current_node = NULL;
int counter;
/* Get to the third node */
current_node = root_node;
for (counter = 0; counter < 2; counter ++)
{
current_node = current_node->next_node;
}
printf("Third string value is %s",
current_node->string_value);
}